package figuras;

public class PuntoVector {
	
	private float x;
	private float y;
	private float z;
    int pv; // punto es 1 vector 0
	
	public PuntoVector(){
	    x=0;
	    y=0;
	    z=0;
	    pv=1;
	}
	
	public PuntoVector(float x,float y,float z,int pv) {
	    this.x=x;
	    this.y=y;
	    this.z=z;
	    this.pv=pv;	    
	}
	
	public PuntoVector(PuntoVector p){
		x=p.x;
	    y=p.y;
	    z=p.z;
	    pv=p.pv;		
	}
	
	public float productoEscalar(PuntoVector p)
	{
		return this.x*p.x + this.y*p.y + this.z*p.z;
	}
	
	public void escalacion(float k){
		x=k*x;
		y=k*y;
		z=k*z;
	}
	
    public float modulo(){
    	return (float)Math.sqrt(x*x+y*y+z*z);
    }
    
    public void normaliza(){
    	float n=this.modulo();
        x=x/n;
        y=y/n;
        z=z/n;
    }
    
    public PuntoVector productoVectorial(PuntoVector p)
    {
    	float det1=(this.y*p.z)-(this.z*p.y);
    	float det2=(this.x*p.z)-(this.z*p.x);
    	float det3=(this.x*p.y)-(this.y*p.x);
        return new PuntoVector(det1,-det2,det3,0);
    }
    
    public double distancia(PuntoVector p){
    	float x2=x-p.x;
    	float y2=y-p.y;
    	float z2=z-p.z;
        return Math.sqrt(x2*x2+y2*y2+z2*z2);
    }
    
    public boolean esMayor(PuntoVector g) 
    {
    	return (y>g.y||(y==g.y && x>g.x));
    }
    
    public PuntoVector perpendicularIzquierda(){
    	return new PuntoVector(-this.y,this.x,this.z,this.pv);
    }

	public float getX() {
		return x;
	}

	public void setX(float x) {
		this.x = x;
	}

	public float getY() {
		return y;
	}

	public void setY(float y) {
		this.y = y;
	}

	public float getZ() {
		return z;
	}

	public void setZ(float z) {
		this.z = z;
	}

	public int getPv() {
		return pv;
	}

	public void setPv(int pv) {
		this.pv = pv;
	}

}
